<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <span id="a"></span>
  <span id="b"></span>
  <span id="c"></span>

  <script type="text/javascript">
    var arr = new Date('2023-7-31')  // 设置据当前时间开始，秒杀的结束时间
    var di = setInterval(num, 1000) // 设置定时器，实现限时秒杀效果
    function num() {
      var array = new Date()// 获取当前时间
      var obj = parseInt((arr - array) / 1000)// 获取时间差，单位秒
      if (obj > 0) {// 判断秒杀是否过期
        a = parseInt(obj / 86400)//计算剩余天
        b = parseInt((obj / 60 / 60) % 24)//计算剩余时
        c = parseInt((obj / 60) % 60)//计算剩余分钟

        a = a < 10 ? '0' + a : a;
        b = b < 10 ? '0' + b : b;
        c = c < 10 ? '0' + c : c;
      }
      else {
        a = b = c = d = '00'
      }
      document.getElementById('a').innerHTML = a + '天';
      document.getElementById('b').innerHTML = b + '时';
      document.getElementById('c').innerHTML = c + '分';
    }
  </script>
</body>

</html>